package com.kernel;

/****************************************
 * @name ObserverDemo
 * @description 演示类
 * @author 黄彬恒
 * @since 2018/7/31
 ***************************************/
public class ObserverDemo {
    public static void main(String[] args) {
        House house = new House(10000.0f);
        HouseObserver houseObserver1 = new HouseObserver("购房者A");
        HouseObserver houseObserver2 = new HouseObserver("购房者B");
        HouseObserver houseObserver3 = new HouseObserver("购房者C");
        house.addObserver(houseObserver3);
        house.addObserver(houseObserver2);
        house.addObserver(houseObserver1);
        System.out.println(house); // 初始化房子的价格
        house.setPrice(6000.0f);
        System.out.println(house); // 变更后房子的价格
    }
}
